Sheffield | ITP-Jan-26 | Hayriye Saricicek | Sprint 3 | Implement and rewrite tests#1266
Conversation
7bec493 to
eaaccca
Compare
|
I've tried reverting but it got very messy with GPT so in the end I made a new branch so that it was clean and not on main. |
There was a problem hiding this comment.
This PR does not yet have a "Needs Review" label.
I assume you are still working on fixing 3-get-card-value.js based on the suggestions you wrote in the comment.
Note: You might have accidently changed the labels in another PR instead of this one.
| expect(getAngleType(1)).toEqual("Acute angle"); | ||
| expect(getAngleType(45)).toEqual("Acute angle"); | ||
| expect(getAngleType(89)).toEqual("Acute angle"); | ||
| expect(getAngleType(91)).toEqual("Obtuse angle"); |
There was a problem hiding this comment.
Since 91 is checked in case 3, it is optional to check it in this group.
Note: To express, "91 should not be considered as Acute angle", in Jest we could write:
expect(getAngleType(91)).not.toEqual("Acute angle");
| if (card.startsWith("10")) { | ||
| firstChar = "10"; | ||
| suit = card[2]; //if it starts with 10 the third character is the suit | ||
| } else { | ||
| firstChar = card[0]; //otherwise | ||
| suit = card[1]; //the second character is the suit | ||
| } |
There was a problem hiding this comment.
Can you test your function with these invalid cases?
getCardValue("2♥2");
getCardValue("2♥♥");
There was a problem hiding this comment.
I have amended it to include these as invalid cases too.
|
The new implementation works (even though its logic is a bit complicated). Here is an approach for you to review: |
| expect(getAngleType(181)).toEqual("Reflex angle"); | ||
| expect(getAngleType(270)).toEqual("Reflex angle"); | ||
| expect(getAngleType(359)).toEqual("Reflex angle"); | ||
| expect(getAngleType(360))not.toEqual("Reflex angle") |
There was a problem hiding this comment.
Typo on line 43.
Doesn't VSCode show .js file with syntax errors in red color?
|
Closing PR because the January ITP run has finished. Feel free to re-open if you're still working on it. |
Self checklist
Changelist
This pull request practices implementing assertions and the use of Jest.
The functIon are written initially with assertions then re-written using jest.